<!-- 
  @name: 充值规则预览
  @date: 2020.3.11
 -->
<template>
	<view class="content">
		<view class="amount">
			<view class="item" v-for="(item, index) in lists" :key="index">
				<view class="icon" v-if="item.recd">荐</view>
				<view class="top-1">
					<text class="t1">充值:</text>
					<text class="t2">￥</text>
					<text class="t3">{{item.chargeMoney}}</text>
				</view>
				<view class="top-2">
					<text>多送 {{item.sendMoney}}元</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lists: [],  //集合
			}
		},
		onLoad() {
			this.dealData();
		},
		methods: {
			//处理信息
			dealData() {
				let data = JSON.parse(this.$store.state.tmpData);
				this.$store.commit('setTmpData', '');
				let obj = {};
				if(data.chargeOneVal && data.enableOne) {
					obj = {};
					obj.chargeMoney = data.chargeOneVal;
					obj.sendMoney = data.sendOneVal;
					obj.recd = true;
					this.lists.push(obj);
				}
				if(data.chargeTwoVal && data.enableTwo) {
					obj = {};
					obj.chargeMoney = data.chargeTwoVal;
					obj.sendMoney = data.sendTwoVal;
					this.lists.push(obj);
				}
				if(data.chargeThreeVal && data.enableThree) {
					obj = {};
					obj.chargeMoney = data.chargeThreeVal;
					obj.sendMoney = data.sendThreeVal;
					this.lists.push(obj);
				}
				if(data.chargeFourVal && data.enableFour) {
					obj = {};
					obj.chargeMoney = data.chargeFourVal;
					obj.sendMoney = data.sendFourVal;
					this.lists.push(obj);
				}
				if(data.chargeFiveVal && data.enableFive) {
					obj = {};
					obj.chargeMoney = data.chargeFiveVal;
					obj.sendMoney = data.sendFiveVal;
					this.lists.push(obj);
				}
				if(data.chargeSixVal && data.enableSix) {
					obj = {};
					obj.chargeMoney = data.chargeSixVal;
					obj.sendMoney = data.sendSixVal;
					this.lists.push(obj);
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: $color-white;
	}
	
	.amount {
		padding: 15rpx;
		.item {
			display: inline-block;
			width: 330rpx;
			padding-bottom: 48rpx;
			margin: 15rpx 15rpx;
			box-shadow: $box-shadow;
			border: 1rpx solid $color-white;
			border-radius: $border-radius-sm;
			background-color: $color-white;
			position: relative;
			.icon {
				width: 56rpx;
				height: 43rpx;
				line-height: 42rpx;
				text-align: center;
				color: $color-white;
				font-size: 30rpx;
				position: absolute;
				top: -1rpx;
				left: -1rpx;
				background-color: #FE4A4A;
				border-radius: $border-radius-sm 0;
			}
			.top-1 {
				width: 100%;
				margin-top: 48rpx;
				text-align: center;
				.t1 {
					font-size: 30rpx;
				}
				.t2 {
					font-size: 36rpx;
					margin-left: 8rpx;
				}
				.t3 {
					margin-left: 10rpx;
					font-size: 50rpx;
					font-family: $font-family-num;
				}
			}
			.top-2 {
				width: 100%;
				margin-top: 40rpx;
				text-align: center;
				color: $color-grey-dark;
				font-size: 30rpx;
			}
		}
	}
</style>
